##################################################################################
#  - EXTBOARD v1.1 - (sep. 2008)
# Instruction Manual for updating standard Fusion (v6.01.xx)
# Based on GPL2, copyright by ZOC, 2007/2008
#
# This package is a cooperation from:
# alcazar, silvermoon, weedorbeat, wibix, silvermoon and (go)ZOC
# the new version 1.1 is generally programmed by silvermoon and ZOC
# Thanks goes to beta-testers, emblinux and firemike for graphical assistance.
#
# THE ExtBoard IS FOR ADVANCED USERS AND USERS WITH PHP-KNOWLEDGE ONLY !!
# Any normal update is not possible, due to the changes in code and database. 
#
##################################################################################
#
#-----[ IMPORTANT NOTE ]------------------------------------------
#
First thing to do is making a full backup (files and db) !!


#
#-----[ COPY ]------------------------------------------
#
Copy the folders and files from the archive to your webspace overwriting existing files.
(Even the files from the previously installed aw_forum_panel)

#
#-----[ UPGRADE ] ------------------------------------------
#

Do you have the extboard 1.0 ?? please renew ONLY the maincore part
in maincore.php; use the new function parseubb and run the script
/update/upgrade.php.
You can ignore the other steps ...

#
#-----[ REQUIREMENTS ]------------------------------------------
#

* aw_forum_panel
Make sure you have installed the aw_forum_panel from wibix! (www.wibix.de)
If not, download and infuse it, it has many special functions.

* forum poll (from xandra)
please install this as infusion ... and have a look in the configuration

* forum ignore (from DwB)
please install this as infusion ... its for ignoring users and the posts in forum

* similar threads (from pirdani)
please install this as infusion ... show you, when existing, similar threads in viewthread.php


* included the highslide feature from http://vikjavev.no/highslide/


# FILE-EDIT
#
#-----[ OPEN ]------------------------------------------
#
maincore.php

#
#-----[ FIND ]------------------------------------------
#
define("THEMES", BASEDIR."themes/");

#
#-----[ AFTER, ADD ]------------------------------------------
#
define("IMAGES_R", IMAGES."ranks/");

require_once INCLUDES."automatic_linking_include.php"; //clickable

// zusatz silvermoon
function strip_umlaute ($text) {
	$search = array("","","","","","","","");
	$replace = array("&auml;","&ouml;","&uuml;","&Auml;","&Ouml;","&Uuml;","&szlig;","&euro;");
	$text = str_replace($search, $replace, $text);
	return $text;
}

#
#-----[ FIND ]------------------------------------------
#
function parsesmileys($message) {
        $smiley = array(
                "#\:\)#si" => "<img src='".IMAGES."smiley/smile.gif' alt='smiley'>",
                "#\;\)#si" => "<img src='".IMAGES."smiley/wink.gif' alt='smiley'>",
                "#\:\(#si" => "<img src='".IMAGES."smiley/sad.gif' alt='smiley'>",
                "#\:\|#si" => "<img src='".IMAGES."smiley/frown.gif' alt='smiley'>",
                "#\:o#si" => "<img src='".IMAGES."smiley/shock.gif' alt='smiley'>",
                "#\:p#si" => "<img src='".IMAGES."smiley/pfft.gif' alt='smiley'>",
                "#b\)#si" => "<img src='".IMAGES."smiley/cool.gif' alt='smiley'>",
                "#\:d#si" => "<img src='".IMAGES."smiley/grin.gif' alt='smiley'>",
                "#\:@#si" => "<img src='".IMAGES."smiley/angry.gif' alt='smiley'>"
        );
        foreach($smiley as $key=>$smiley_img) $message = preg_replace($key, $smiley_img, $message);
        return $message;
}

#
#-----[ REPLACE WITH ]------------------------------------------
#
function parsesmileys($message) {
    $query = mysql_query("select * from ".DB_PREFIX."smilies") or die(mysql_error());
        while($row = mysql_fetch_object($query))
	{
        $img="<img src=".IMAGES."smiley/".$row->smile_url.">";
        $message =str_replace($row->code,$img,$message);
        }
    return $message;
}

#
#-----[ FIND ]------------------------------------------
#
function displaysmileys($textarea) {
        $smiles = "";
        $smileys = array (
                ":)" => "smile.gif",
                ";)" => "wink.gif",
                ":|" => "frown.gif",
                ":(" => "sad.gif",
                ":o" => "shock.gif",
                ":p" => "pfft.gif",
                "B)" => "cool.gif",
                ":D" => "grin.gif",
                ":@" => "angry.gif"
        );
        foreach($smileys as $key=>$smiley) $smiles .= "<img src='".IMAGES."smiley/$smiley' alt='smiley' onClick=\"insertText('$textarea', '$key');\">\n";
        return $smiles;
}

#
#-----[ REPLACE WITH ]------------------------------------------
#
function displaysmileys($textarea) {
    $querya = mysql_query("select * from ".DB_PREFIX."smilies WHERE view='1' LIMIT 0,10") or die(mysql_error());
        while($rowa = mysql_fetch_object($querya)){
        $smiles="$smiles <img src='".IMAGES."smiley/$rowa->smile_url' onClick=\"insertText('$textarea', '$rowa->code '); overlayclose('smiley'); \">\n";
        }
    return $smiles;
}

#
#-----[ AFTER, ADD ]------------------------------------------
#
// Show more smiley icons
function displaysmileys_more($textarea) {
    $querya = mysql_query("select * from ".DB_PREFIX."smilies WHERE view='1' LIMIT 10,99") or die(mysql_error());
        while($rowa = mysql_fetch_object($querya)){
        $smiles="$smiles <img src='".IMAGES."smiley/$rowa->smile_url' onClick=\"insertText('$textarea', '$rowa->code ');\">\n";
        }
    return $smiles;
}


#
#-----[ FIND ]------------------------------------------
#
// Parse bbcode into HTML code
function parseubb($text) {

#
#-----[ FIND ]------------------------------------------
#
change the hole functions with this:


// Parse bbcode into HTML code
// new version by silvermoon 07/2008

function parseubb($text,$forumubb='') {

/** forum ubb **/  
if ($forumubb) {
$forumparse = explode(",",$forumubb); 
} else {
 $forumparse[0]=false;
 $forumparse[1]=false;
}
/** end **/

	$text = preg_replace('#\[b\](.*?)\[/b\]#si', '<b>\1</b>', $text);
	$text = preg_replace('#\[i\](.*?)\[/i\]#si', '<i>\1</i>', $text);
	$text = preg_replace('#\[u\](.*?)\[/u\]#si', '<u>\1</u>', $text);
	$text = preg_replace('#\[center\](.*?)\[/center\]#si', '<center>\1</center>', $text);

	$text = preg_replace('#\[url\]([\r\n]*)(http://|ftp://|https://|ftps://)([^\s\'\";\+]*?)([\r\n]*)\[/url\]#si', '<a href=\'\2\3\' target=\'_blank\'>\2\3</a>', $text);
	$text = preg_replace('#\[url\]([\r\n]*)([^\s\'\";\+]*?)([\r\n]*)\[/url\]#si', '<a href=\'http://\2\' target=\'_blank\'>\2</a>', $text);

	$text = preg_replace('#\[url=([\r\n]*)(http://|ftp://|https://|ftps://)([^\s\'\";\+]*?)\](.*?)([\r\n]*)\[/url\]#si', '<a href=\'\2\3\' target=\'_blank\'>\4</a>', $text);
	$text = preg_replace('#\[url=([\r\n]*)([^\s\'\";\+]*?)\](.*?)([\r\n]*)\[/url\]#si', '<a href=\'http://\2\' target=\'_blank\'>\3</a>', $text);
	
	$text = preg_replace('#\[mail\]([\r\n]*)([^\s\'\";:\+]*?)([\r\n]*)\[/mail\]#si', '<a href=\'mailto:\2\'>\2</a>', $text);
	$text = preg_replace('#\[mail=([\r\n]*)([^\s\'\";:\+]*?)\](.*?)([\r\n]*)\[/mail\]#si', '<a href=\'mailto:\2\'>\2</a>', $text);
	
	$text = preg_replace('#\[small\](.*?)\[/small\]#si', '<span class=\'small\'>\1</span>', $text);
	$text = preg_replace('#\[color=(black|blue|brown|cyan|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|violet|white|yellow)\](.*?)\[/color\]#si', '<span style=\'color:\1\'>\2</span>', $text);
	
	$text = preg_replace('#\[size=(4|6|8|10|12|14|16|18|20|22|24|26|28|30|32|34|36|38|40|42)\](.*?)\[/size\]#si', '<span style=\'font-size:\1\'>\2</span>', $text);

// spoiler funktion, zoc, 21.07.08
	echo "<script type='text/javascript' src='".INCLUDES."forum.js'></script>";
	$text = preg_replace('#\[spoiler\](.*?)\[/spoiler\]#si', '<div><div id=\'pre-spoiler\'><input name=\'button\' type=\'button\' style=\'width:50px;font-size:9px;margin:0px;padding:0px;\' onClick=\'spoil(this);\' value=\'Spoiler >\'></div><div><div id=\'spoiler\' class=\'textbox\' style=\'display:none;padding:3px;border: 1px dashed;border-color:silver;margin:1px; \'>\1</div></div></div>', $text);

/** extboard settings, videos **/
if ($forumparse[0]) {

// googlevideo
$text = preg_replace('#\[googlevideo\](.*?)videoplay(.*?)\[/googlevideo\]#si', '[googlevideo]\1googleplayer.swf\2[/googlevideo]', $text);
$text = preg_replace('#\[googlevideo\](.*?)\[/googlevideo\]#si', '<object type=\'application/x-shockwave-flash\' id=\'VideoPlayback\' width=\'464\' height=\'380\' data=\'\\1\'><param name=movie value=\'\\1\'><param name=\'wmode\' value=\'transparent\'><param name=\'quality\' value=\'high\'><param name=\'bgcolor\' value=\'#ffffff\'></object>', $text);

// clipfish
$text = preg_replace('#\[clipfish\](.*?)player.php\?(.*?)\[/clipfish\]#si', '[clipfish]\1videoplayer.swf?as=0&\2[/clipfish]', $text);
$text = preg_replace('#\[clipfish\](.*?)\[/clipfish\]#si', '<object type=\'application/x-shockwave-flash\' id=\'VideoPlayback\' width=\'464\' height=\'388\' data=\'\\1\'><param name=movie value=\'\\1\'><param name=\'wmode\' value=\'transparent\'><param name=\'quality\' value=\'high\'><param name=\'bgcolor\' value=\'#999999\'></object>', $text);

// myvideo.de
$text = preg_replace('#\[myvideo\](.*?)watch(.*?)\[/myvideo\]#si', '[myvideo]\1movie\2[/myvideo]', $text);
$text = preg_replace('#\[myvideo\](.*?)\[/myvideo\]#si', '<object type=\'application/x-shockwave-flash\' id=\'VideoPlayback\' width=\'464\' height=\'380\' data=\'\\1\'><param name=movie value=\'\\1\'></object>', $text);

// youtube	
$text = preg_replace('#\[youtube\](.*?)watch\?(.*?)\[/youtube\]#si', '[youtube]\1\2[/youtube]', $text);
$text = preg_replace('#\[youtube\](.*?)=(.*?)\[/youtube\]#si', '[youtube]\1/\2[/youtube]', $text);
$text = preg_replace('#\[youtube\](.*?)\[/youtube\]#si', '<object width="464" height="380"><param name="movie" value="\1"></param><embed src="\1" type="application/x-shockwave-flash" width="464" height="380"></embed></object>', $text);

}
/** videosettings end **/
	
	$text = preg_replace('#\[flash width=([0-9]*?) height=([0-9]*?)\]([^\s\'\";:\+]*?)(\.swf)\[/flash\]#si', '<object classid=\'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\' codebase=\'http://active.macromedia.com/flash6/cabs/swflash.cab#version=6,0,0,0\' id=\'\3\4\' width=\'\1\' height=\'\2\'><param name=movie value=\'\3\4\'><param name=\'quality\' value=\'high\'><param name=\'bgcolor\' value=\'#ffffff\'><embed src=\'\3\4\' quality=\'high\' bgcolor=\'#ffffff\' width=\'\1\' height=\'\2\' type=\'application/x-shockwave-flash\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\'></embed></object>', $text);
	
//Antistretch Mod Start
    $maxwidth = 400;
    $pattern = "#\[img\](.*?)\[/img\]#si";
    $images = array();
    $count = preg_match_all($pattern, $text, $images);
    if($count) {
    	for($i=0; $i<$count; ++$i) {
		$url = $images[1][$i];
		$data = @getimagesize($url);
		if($data!==false) {
			$width = $data[0];
			if($width < $maxwidth) {
				$text = str_replace($images[0][$i], "<img src='".$url."' style='border:0px'>", $text);
			} else {
				$text = str_replace($images[0][$i], "<div><a id='thumb1' href='".$url."' title='Click for fullsize' class='highslide' onclick='return hs.expand(this)'><img src='".$url."' style='border:0px; max-width:".$maxwidth."px'></a></div>", $text);
			}
		} else {
			$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)(.*?)(\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG))\[/img\]#sie","'<div><a href=\'\\1'.str_replace(array('?','&','='),'','\\3').'\\4\' id=\'thumb1\' target=\'_blank\' title=\'Click for zoom\' class=\'highslide\' onclick=\'return hs.expand(this)\'><img src=\'\\1'.str_replace(array('?','&','='),'','\\3').'\\4\' style=\'border:0px;  max-width:400px; max-height:400px\'></a></div>'",$text);
		    }
		}
    }
//Antistretch Mod End

	$qcount = substr_count($text, "[quote]"); $ccount = substr_count($text, "[code]");
	// versuch fr gestylten quote
	for ($i=0;$i < $qcount;$i++) $text = preg_replace('#\[quote\](.*?)\[/quote\]#si', '<table class=\'quote\' border=\'0\' width=\'450\'><tr><th class=\'button\' align=\'left\'><b>Quote:</b></th></tr><td><div class=\'small\' style=\'max-width:450px;overflow:auto\'>\1<br></div></td></tr></table>', $text);
	
	for ($i=0;$i < $ccount;$i++) $text = preg_replace('#\[code\](.*?)\[/code\]#si', '<table class=\'quote\' border=\'0\' width=\'450\' style=\'margin:0px 2px 0px 2px;\'><tr><th class=\'button\' align=\'left\'><b>Code:</b></th></tr><td><div  style=\'max-width:500px;max-height:450px;overflow:auto\'>\1<br></div></td></tr></table>', $text);

/** extboard settings, geshi code **/
if ($forumparse[1]) {
include (INCLUDES.'geshi_bbcode_include.php');
}
/** extboard settings, geshi code END **/

	if (!isset($_REQUEST['stext']) && !isset($_REQUEST['highlight'])) {
	$text = make_clickable($text); //clickable
	}
	$text = descript($text,false);
	return $text;
}


#
#-----[ FIND ]------------------------------------------
#
search for the function descript

$text = preg_replace('#(<[^>]+[\\"\'\s])(onmouseover|onmousedown|onmouseup|onmouseout|onmousemove|onclick|ondblclick|onload|xmlns)[^>]*>#iU', ">", $text);

and DELETE the "|onclick"


#
#-----[ CLOSE FILE ]------------------------------------------
#

#
#-----[ db-update SQL ]---------------------------------------
#

!! If you have the standard-forum hast, use update/INSTALL.PHP  !!

!! If you have an Extboard (1.0) yet, use update/UPGRADE.PHP !!

If all OK, delete the file and proceed.
If not, retry or report to support forum.


##################################################################################
# NOTES
##################################################################################

* Some other important functions for the forum area are in the file "forum_functions_include.php"

* For quickreply in viewthread.php opensidex is used.
  If you want you can use the better opentablex by copying it from the theme.php (Area 69 Theme) to your theme.
  To activate it:
#
#-----[ OPEN ]------------------------------------------
#
viewthread.php

#
#-----[ FIND ]------------------------------------------
#
// opentablex("<center><b>".$locale['512']."</b></center>","off");
opensidex("<center><b>".$locale['512']."</b></center>","off");

#
#-----[ REPLACE WITH ]------------------------------------------
#
opentablex("<center><b>".$locale['512']."</b></center>","off");
// opensidex("<center><b>".$locale['512']."</b></center>","off");

#
#-----[ CLOSE FILE ]------------------------------------------
#
* Themes and graphics:
  ExtBoard comes with 3 themes, some grahpics used are in these only.
  If you want to use it in your theme copy the files delete.gif, left.gif, right.gif to your theme.

* Displaying Global Moderators in profile
#
#-----[ OPEN ]------------------------------------------
#
profile.php

#
#-----[ FIND ]------------------------------------------
#
<td align='right' class='tbl2'>".getuserlevel($data['user_level'])."</td>

#
#-----[ REPLACE WITH ]------------------------------------------
#
<td align='right' class='tbl2'>".getuserlevel($data['user_level']);
if($data['user_global_mod'] == '1') echo " (Global Moderator)";
echo "</td>

#
#-----[ CLOSE FILE ]------------------------------------------
#

#
# D O C ########################################################################
#

----------------------------------------------------------------
FORENADMINISTRATION:

You can only assign users as Forum Moderators if they have access to the forum and can either post or reply
else there are no settings.
Forum Administration has been extended and has partly its own logic and "intelligence".
Please take your time to get used to it.
In the Forum Overview you can see who is moderator and the rights for the Forum.
 
Groups:
If you set the Forum Rights to "Group", then only the specified groups (and Superadmins) are granted these rights.
Group rights are set via the "Group Rights" menu (execept "Moderator" you can set only those rights that are set to "group")
 
Important Change!! 
The general and all other forum configuration, is now under Content-Admin -> Forums
Here you can enable and set the color groups for the user_levels Moderator, Global Moderator, Admin, Superadmin. 
They're predefined colors, you can change them to your need.
And there are SOME other and new functions, which are can activate or modify.

 
GlobalMods:
Global Moderators are set via the member admin (editing the user).

-----------------------------------------------------------------
The new image-function in maincore.php should work in most cases.

The video-links (new function in maincore.php) should work with the usual URLs.
Especially at Clipfish, where some links are not correct. Please check this.
Example for working links:

Youtube: http://www.youtube.com/watch?v=FClmtowd6XE
GoogleVideo: http://video.google.com/videoplay?docid=-3389980029353435416
MyVideo: http://www.myvideo.de/watch/1244115
Clipfish: http://www.clipfish.de/player.php?videoid=MjYxMnwyMg%3D%3D&cat=1


Have fun with the new ExtBoard v1.1
ZOC and Silvermoon